package com.ryzy.springbootdruidmybatis.controller;

import com.ryzy.springbootdruidmybatis.model.User;
import com.ryzy.springbootdruidmybatis.service.IUserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class UserController {

    @Resource
    private IUserService userService;

    @GetMapping("/setUser")
    public int setUser(){
        User user = new User();
        user.setUsername("张三");
        user.setPassword("12121212");
        user.setAge(23);
        return  userService.insertSelective(user);
    }

    @GetMapping("/getUser")
    public User getUser(){
        return userService.selectByPrimaryKey(2);
    }


}
